package com.woniuxy.moneyapp.service.impl;


import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.woniuxy.commons.util.BeanCopyUtil;
import com.woniuxy.moneyapp.infra.RechargeRecordDao;
import com.woniuxy.moneyapp.infra.dto.RechargeRecordDto;
import com.woniuxy.moneyapp.infra.model.RechargeRecord;
import com.woniuxy.moneyapp.service.RechargeRecordService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.Collection;
import java.util.Collections;
import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author seven
 * @since 2022-08-01
 */
@Service
public class RechargeRecordServiceImpl extends ServiceImpl<RechargeRecordDao, RechargeRecord> implements RechargeRecordService {


    @Override
    public List<RechargeRecordDto> allRechargeRecord(Integer uid) {
        List<RechargeRecord> lists = baseMapper.selectList(new QueryWrapper<RechargeRecord>().eq("user_id", uid));
        Collections.reverse(lists);
        return BeanCopyUtil.copyList(lists,RechargeRecordDto.class);
    }
}
